#include "../include/utils.h"

void trim(std::string& str) {
  int len = str.length();
  int start(0), end;
  while (str[start] == ' ' && start < len)
    ++start;
  if (start == len) {
    str = "";
    return;
  }
  for (end = len - 1; end > start; --end)
    if (str[end] != ' ')
      break;
  str = str.substr(start, end - start + 1);
  return;
}

bool is_greater(const std::pair<int, float> &lhs,
    const std::pair<int, float> &rhs) {
  return lhs.second > rhs.second;
}

